﻿CREATE TABLE [dbo].[AngajamentBugetar] (
    [IDAB]             INT             IDENTITY (1, 1) NOT NULL,
    [Numar]            VARCHAR (20)    NOT NULL,
    [Data]             DATETIME        CONSTRAINT [DF_AngajamentBugetar_Data] DEFAULT (getdate()) NOT NULL,
    [Compartiment]     VARCHAR (250)   CONSTRAINT [DF_AngajamentBugetar_Compartiment] DEFAULT ('') NOT NULL,
    [Scopul]           VARCHAR (250)   CONSTRAINT [DF_AngajamentBugetar_Scopul] DEFAULT ('') NOT NULL,
    [Beneficiarul]     VARCHAR (250)   CONSTRAINT [DF_AngajamentBugetar_Beneficiarul] DEFAULT ('') NOT NULL,
    [CodUnitate]       SMALLINT        CONSTRAINT [DF_AngajamentBugetar_CodUnitate] DEFAULT ((0)) NOT NULL,
    [SumaTotala]       DECIMAL (18, 2) CONSTRAINT [DF_AngajamentBugetar_Suma] DEFAULT ((0)) NOT NULL,
    [VizatCFP]         BIT             CONSTRAINT [DF_AngajamentBugetar_VizatCFP] DEFAULT ((0)) NOT NULL,
    [MotivRefuz]       VARCHAR (250)   CONSTRAINT [DF_AngajamentBugetar_MotivRefuz] DEFAULT ('') NOT NULL,
    [IDResponsabil]    INT             CONSTRAINT [DF_AngajamentBugetar_IDResponsabil] DEFAULT ((0)) NOT NULL,
    [DataVizaCFP]      DATETIME        CONSTRAINT [DF_AngajamentBugetar_DataVizaCFP] DEFAULT (getdate()) NOT NULL,
    [NrRegCFP]         VARCHAR (20)    CONSTRAINT [DF_AngajamentBugetar_NrRegCFP] DEFAULT ('') NOT NULL,
    [OrdonatorCredite] VARCHAR (100)   CONSTRAINT [DF_AngajamentBugetar_OrdonatorCredite] DEFAULT ('') NOT NULL,
    [TipAngajament]    SMALLINT        NOT NULL,
    [IDPAC]            INT             NULL,
    CONSTRAINT [PK_AngajamentBugetar] PRIMARY KEY CLUSTERED ([IDAB] ASC),
    CONSTRAINT [FK_AngajamentBugetar_PropunereAngajareCheltuiala] FOREIGN KEY ([IDPAC]) REFERENCES [dbo].[PropunereAngajareCheltuiala] ([IDPAC]),
    CONSTRAINT [FK_AngajamentBugetar_ResponsabilVizaCFP] FOREIGN KEY ([IDResponsabil]) REFERENCES [dbo].[ResponsabilVizaCFP] ([IDResponsabil]),
    CONSTRAINT [FK_AngajamentBugetar_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);

